#include <iostream>
#include <string>
#include <cctype>
#include <algorithm>
using namespace std;
const int maxn = 100;
string arr[maxn], a[maxn], b[maxn];
int mp[300], acnt = 0, bcnt = 0;
void initMp()
{
	mp['K'] = 0;
	mp['Q'] = 1;
	mp['R'] = 2;
	mp['B'] = 3;
	mp['N'] = 4;
	for (int i = 0; i < 8; i++)
	{
		mp[i + 'a'] = i + 5;
	}
	for (int i = 0; i < 10; i++)
	{
		mp[i + '1'] = i + 13;
	}
}
bool cmp(string a, string b)
{
	for (int i = 0; i < 3; i++)
	{
		if (mp[a[i]] < mp[b[i]])
			return 1;
		else if (mp[a[i]] > mp[b[i]])
			return 0;
	}
}
int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0);
	initMp();
	for (int i = 0; i < 17; i++)
		cin >> arr[i];
	int len = arr[1].length();
	for (int i = 1; i < 17; i += 2)
	{
		for (int j = 2; j < len; j += 4)
		{
			if (arr[i][j] == '.' || arr[i][j] == ':')
				continue;
			else if (isupper(arr[i][j]))
			{
				if (arr[i][j] != 'P')
					a[acnt] += arr[i][j];
				a[acnt] += (17 - i) / 2 + '0';
				a[acnt++] += j / 4 + 'a';
			}
			else
			{
				if (arr[i][j] != 'p')
					b[bcnt] += arr[i][j] - 'a' + 'A';
				b[bcnt] += (17 - i) / 2 + '0';
				b[bcnt++] += j / 4 + 'a';
			}
		}
	}
	sort(a, a + acnt, cmp);
	for (int i = 0; i < 10; i++)
	{
		mp[i + '1'] = 25 - i;
	}
	sort(b, b + bcnt, cmp);
	cout << "White: ";
	for (int i = 0; i < acnt; i++)
	{
		int l = a[i].length();
		swap(a[i][l - 1], a[i][l - 2]);
		cout << a[i];
		if (i != acnt - 1)
			cout << ',';
	}
	cout << "\nBlack: ";
	for (int i = 0; i < bcnt; i++)
	{
		int l = b[i].length();
		swap(b[i][l - 1], b[i][l - 2]);
		cout << b[i];
		if (i != bcnt - 1)
			cout << ',';
	}
	return 0;
}